package com.rxjava.simplemap;

import com.rxjava.User;

/**
 * Created by iceGeneral on 2016/10/15.
 */
public class Test {
    public static void main(String[] args) {

    	Observable
        .create(new OnSubscribe<Integer>() {
            @Override
            public void call(Subscriber<? super Integer> subscriber) {
            	System.out.println("step5");
                subscriber.onNext(2);
            }
        })
        .map(new Func1<Integer, String>() {
            @Override
            public String call(Integer integer) {
            	System.out.println("step7");
                return "map" + integer;
            }
        })
        .map(new Func1<String, User>() {
        	@Override
        	public User call(String str) {
        		System.out.println("step8");
        		return new User(str);
        	}
        })
        .subscribe(new Subscriber<User>() {
            @Override
            public void onNext(User u) {
                System.out.println(u);
            }
        });
    	System.out.println("-------------------------------------------------------------");
    }

}
